package com.hanlin.tank;

import com.sun.org.apache.bcel.internal.util.ClassPath;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * 描述：
 *
 * @author:hl.yuan
 * @date:2022-02-09
 */
public class PropertyMgr {

    public static BufferedImage goodTankL, goodTankU, goodTankR, goodTankD;

    public static BufferedImage badTankL, badTankU, badTankR, badTankD;

    public static BufferedImage bulletL, bulletU, bulletR, bulletD;

    public static List<BufferedImage> bufferedImageList = new ArrayList<>();

    static {
        try {
            // 把坦克的图片加载到内存
            goodTankU = ImageIO.read(PropertyMgr.class.getClassLoader().getResourceAsStream("images/GoodTank1.png"));
            goodTankL = ImageUtil.rotateImage(goodTankU, -90);
            goodTankR = ImageUtil.rotateImage(goodTankU, 90);
            goodTankD = ImageUtil.rotateImage(goodTankU, 180);
            badTankU = ImageIO.read(PropertyMgr.class.getClassLoader().getResourceAsStream("images/BadTank1.png"));
            badTankL = ImageUtil.rotateImage(badTankU, -90);
            badTankR = ImageUtil.rotateImage(badTankU, 90);
            badTankD = ImageUtil.rotateImage(badTankU, 180);

            bulletU = ImageIO.read(PropertyMgr.class.getClassLoader().getResourceAsStream("images/bulletU.png"));
            bulletL = ImageUtil.rotateImage(bulletU, -90);
            bulletR = ImageUtil.rotateImage(bulletU, 90);
            bulletD = ImageUtil.rotateImage(bulletU, 180);

            for (int i = 1; i <= 16; i++) {
                bufferedImageList.add(ImageIO.read(PropertyMgr.class.getClassLoader().getResourceAsStream("images/e"+i+".gif")));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
